<?php
    session_start();
    if(!isset($_SESSION['usuario'])){
            header('location:../html/login.html');
         }
         
         $nombres = $_REQUEST["nomb"];
?>

<!DOCTYPE html>
<html>
    <head>
        <title>Inicio</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

        <script src="jquery-1.9.1.min.js"></script>
        
        <style>
            
            #menu-trigger { /* Hide it initially */
    display: none;
}

@media screen and (max-width: 600px) {

    #menu-wrap {
        position: relative;
    }

    #menu-wrap * {
        box-sizing: border-box;
    }

    #menu-trigger {
        display: block; /* Show it now */
        height: 40px;
        line-height: 40px;
        cursor: pointer;        
        padding: 0 0 0 35px;
        border: 1px solid #222;
        color: #fafafa;
        font-weight: bold;
        background-color: #111;
        /* Multiple backgrounds here, the first is base64 encoded */
        background: url(...) no-repeat 10px center, linear-gradient(#444, #111);
        border-radius: 6px;
        box-shadow: 0 1px 1px #777, 0 1px 0 #666 inset;
    }

    #menu {
        margin: 0; padding: 10px;
        position: absolute;
        top: 40px;
        width: 100%;
        z-index: 1;
        display: none;
        box-shadow: none;       
    }

    #menu:after {
        content: '';
        position: absolute;
        left: 25px;
        top: -8px;
        border-left: 8px solid transparent;
        border-right: 8px solid transparent;
        border-bottom: 8px solid #444;
    }   

    #menu ul {
        position: static;
        visibility: visible;
        opacity: 1;
        margin: 0;
        background: none;
        box-shadow: none;               
    }

    #menu ul ul {
        margin: 0 0 0 20px !important;
        box-shadow: none;       
    }

    #menu li {
        position: static;
        display: block;
        float: none;
        border: 0;
        margin: 5px;
        box-shadow: none;           
    }

    #menu ul li{
        margin-left: 20px;
        box-shadow: none;       
    }

    #menu a{
        display: block;
        float: none;
        padding: 0;
        color: #999;
    }

    #menu a:hover{
        color: #fafafa;
    }   

    #menu ul a{
        padding: 0;
        width: auto;        
    }

    #menu ul a:hover{
        background: none;   
    }

    #menu ul li:first-child a:after,
    #menu ul ul li:first-child a:after {
        border: 0;
    }       

}

@media screen and (min-width: 600px) {
    #menu {
        display: block !important;
    }
}   

/* iPad */
.no-transition {
    transition: none;
    opacity: 1;
    visibility: visible;
    display: none;          
}

#menu li:hover > .no-transition {
    display: block;
}
            
        </style>
        
        <script>
            function bien(){
                /*funcion para invocar el funcionamiento de el calendario*/
                //var val = document.getElementById('hdnu').value;
                //alert(""+val);
                if($("#hdnu").val() !== ""){
                    document.getElementById("bien").innerHTML = "<table border=''>\
                                                                    <tr>\
                                                                        <td>\
                                                                            Bienvenido "+ $("#hdnu").val() +"\
                                                                        </td>\
                                                                    </tr>\
                                                                 </table>";
                }else{
                    document.getElementById("bien").innerHTML = "";
                }
            }
        </script>
        <script type="text/javascript">
            
            </script>
        
        <?php
            echo '<center>
                  <div id="conte">
                       <table id="tablit" align="center">
                           <tr>
                               <td colspan=2>
                                    <img src="../imagen/BANNERSES.png" width="1250" height="125" alt="BANNERSES"/>
                               </td>
                           </tr>
                           <tr>
                           </tr>
                            <tr>
                                <td>';
        ?>
    </head>
    <body>
    <div id="wrapper">
        <nav>
            <ul id="menu">
                <?php
                    include '../../controlador/php/conexion/Conexion.php';
                    $con = new Conexion();
                    
                    $n = $_SESSION['tama'];//tamaño de la lista(Modulos y submodulos)
                    $i = 0;
                    $temp = "";
                    $oidmod = "";
                    $cont = 0;
                   // $oidmod2 = 0;
                    /*sacamos variables de sesion del menu*/
                    while($i < $n){
                        $modulo = $_SESSION['modulo'.$i];
                        $submod = $_SESSION['submod'.$i];
                        $dire = $_SESSION['dir'.$i];
                        //$oidmod2 = $_SESSION['mod2'.$cont];
                        //condicionamos para que no se repita el nombre del modulo
                        if($temp != $modulo){
                            $oidmod = $_SESSION['mod1'.$i];
                            /*se condiciona para cuando el contador inicielice en 0 y cerrar el modulo*/
                             if($cont != 0){
                                print("</ul></li>");
                            }
                            echo"<li>
                                        <a href='#'>".$modulo."</a><ul>";
                        }
                                echo"
                                        <li>
                                            <a href='".$dire."'>".$submod."</a>
                                        </li>";
                        $temp = $modulo;
                        $i++;
                        $cont++;
                    }
                      ?>

            </ul>          
        </nav>
                           <?php
                                         echo '
                           
                              </tr><tr><td align=right id="sesion"><strong>Sesion:</strong> '.$_SESSION['nombre'].'
                              <a href="../../controlador/php/sql/cerrarSesion.php">
                                      <img src="../imagen/cesesion.png" title="cerrar sesion" width="20" height="20" alt="csesion" align="absbottom"/>
                                  </a>
                              </td><tr>';
                           ?>
                      </tr>
                      <tr>
                          <td>
                              <input  type="hidden" id="hdnu" value="<?php echo$nombres ?>" />
                          </td>
                      </tr>
              </table>
              </br></br>
              <table>
                  <tr>
                          <td align="center" colspan="2">
                              <div id="bien">
                                  
                              </div>
                          </td>
                      </tr>
              </table>
              </div>
    </body>
</html>
              <div>
     </center>
     
  
    


   
